<meta charset="utf-8">
<style>

        .lay-box{
            border: 1px #dfdfdf solid;
            width: 98%;
            height: 95%;
            margin: 0 auto;
            padding-top: 1rem;
        }
        .lay-box .lay-content{
            width: 40%;
            margin-left: 20%;
            height: 2rem;
        }
        .lef{
            width: 25%;
            text-align: right;
            float: left;
        }
        .lay-box .lay-content .lay-span{
            font-size: 0.2rem;
            color: #a4a4a4;
            text-align: right;
        }
        .lay-box .lay-content .rig{
            float: right;
            width: 75%;
        }
        select{
            border: 1px solid #9F9F9F;
            font-size: 0.7rem;
            padding: 0.25rem 0.4rem;
            margin-left: 0.2rem;
            color: black;
            width: 82%;
            outline:none;
        }
        .lay-box .lay-content .rig .lay-input-text{
            border: 1px solid #9F9F9F;
            font-size: 0.7rem;
            padding: 0.28rem 0.4rem;
            margin-left: 0.2rem;
            color: black;
            outline:none;
            border-radius: 1px;
        }
        .lay-box .lay-content .rig .lay-submit{
            background: #01AAED;
            padding: 0.5rem 3rem;
            color: white;
            border-radius: 6px;
            margin-top: 1.2rem;
            outline:none;
            border: none;
        }

    </style>
<div class="lay-box">

    <div class="lay-content">
        <div class="lef">
            <span class="lay-span">账号：</span>
        </div>
        <div class="rig">
            <input type="text" name="username" disabled="disabled" value="{$user['username']}" class="lay-input-text"><br>
        </div>
    </div>
    <div class="lay-content">
        <div class="lef">
            <span class="lay-span">姓名：</span>
        </div>
        <div class="rig">
            <input type="text" name="name" value="{$user['name']}" class="lay-input-text"><br>
        </div>
    </div>
    <div class="lay-content">
        <div class="lef">
            <span class="lay-span">其他设置：</span>
        </div>
        <div class="rig" style="font-size: 12px;">
            <input type="checkbox" class="textbox-text" {if condition="$user['allow_mobile'] == 1"}checked{/if} autocomplete="off"  name="allow_mobile">允许查看号主手机<br>
            <input type="checkbox" class="textbox-text" {if condition="$user['allow_qq'] == 1"}checked{/if} autocomplete="off"  name="allow_qq">允许查看号主QQ号<br>
            <input type="checkbox" class="textbox-text" {if condition="$user['allow_taobao'] == 1"}checked{/if} autocomplete="off"  name="allow_taobao">允许查看号主淘宝会员名<br>
            <input type="checkbox" class="textbox-text" {if condition="$user['allow_msg'] == 1"}checked{/if} autocomplete="off"  name="allow_msg">允许发短信给号主
        </div>
    </div>
    <br><br><br>
    <div class="lay-content">
        <div class="lef">
            <span class="lay-span">备注：</span>
        </div>
        <div class="rig" style="font-size: 12px;">
            <textarea name="remark" id="remark">{$user['remark']}</textarea>
        </div>
    </div>
    <div class="lay-content">
        <div class="rig">
            <input type="hidden" name="id" value="{$user['id']}">            
            <input type="submit" value="提交" onclick="btnEditMember()" class="lay-submit">
        </div>
    </div>
</div>
<script src="/resource/libs/jquery/jquery.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script type="text/javascript">
    function btnEditMember(){
        var id = $("input[name=id]").val();
        var name = $("input[name=name]").val();
        var allow_mobile = 0;
        if($("input[name=allow_mobile]").is(':checked')) {
            allow_mobile = 1;
        }
        var allow_taobao = 0;
        if($("input[name=allow_taobao]").is(':checked')) {
            allow_taobao = 1;
        }
        var allow_qq = 0;
        if($("input[name=allow_qq]").is(':checked')) {
            allow_qq = 1;
        }
        var allow_msg = 0;
        if($("input[name=allow_msg]").is(':checked')) {
            allow_msg = 1;
        }
        var remark = $("#remark").val();
        if(!$.trim(name)) {
            layer.msg('请输入姓名');
            return false;
        }
        $.post('/index/user/memberedit',{id:id,name:name,allow_mobile:allow_mobile,allow_taobao:allow_taobao,allow_qq:allow_qq,allow_msg:allow_msg,remark:remark},function(res){
            layer.msg(res.msg);
            if(res.code == 1){
                window.setTimeout(function(){
                    window.parent.location.reload();
                },1000);
            }
        });
    }
    //判断ip地址的合法性
    function checkIP(value){
        var exp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
        var reg = value.match(exp);
        if(reg==null)
        {
        return false;
        }
    }
</script>